//
//  StringHelper.h
//
//
//

#import <Foundation/Foundation.h>

@interface StringHelper : NSObject {
}
+ (BOOL)stringIsEmpty:(NSString *)str;

+ (NSString *)stringOrEmpty:(NSString *)str;

+ (NSUInteger)chineseStringLen:(NSString *)str;

+ (NSString *)cutString:(NSString *)str length:(NSUInteger)length;

+ (NSString *)MD5:(NSString *)str;

+ (NSString *)encodeBase64:(NSString *)str;

+ (NSString *)decodeBase64:(NSString *)str;

+ (NSString *)generateGUID;

+ (NSString *)stringByDecodingURLFormat:(NSString *)str;
+ (NSString *)stringByEncodingURLFormat:(NSString *)str;

+ (NSString *)encodeGB2312Str:(NSString *)str;
+ (NSString *)decodeGB2312Str:(NSString *)str;

+ (BOOL)versionCompare:(NSString *)localVersion serverVersion:(NSString *)serverVersion;
//判断逻辑是两个变量如果只有一个为nil，则为不同，随后比较他们的值，如果不同返回假
+ (BOOL)compareString:(NSString *)oneString isEqualTo:(NSString *)anotherString;

//sqlite转义替换
+ (NSString *)sqliteEscape:(NSString *)keyWord;

+ (BOOL)isValidateEmail:(NSString *)email;
+ (BOOL)isValidChinesePhone:(NSString *)number;
+ (BOOL)isOnlyNumOrCharacter:(NSString *)string;
+ (BOOL)isValidateMIEPassword:(NSString *)password;

+ (NSString *)formatDistanceFromNumber:(NSNumber *)number;
+ (NSString *)formattedStringFromNumber:(NSNumber *)number;
+ (NSString *)formatCalFromNumber:(NSNumber *)number;
+ (NSNumber *)valueFromString:(NSString *)string;
+ (NSString *)commaNumber:(NSNumber *)number;
+ (NSString *)noStyleNumber:(NSNumber *)number;
+ (NSString *)ceilingToOneFraction:(NSNumber *)number;
+ (NSString *)currentLanguage;
+ (int)minutesFromSec:(int)sec;

//get height base on font and content
+(CGFloat)HeightWithBoundSize:(CGSize)size Text:(NSString*)text font:(UIFont *)font;

+ (BOOL)isChineseCharacter:(NSString *)string;

+ (BOOL)isContainerOfString:(NSString *)string withCompareString:(NSString *)compareString;

@end

@interface NSString (StringHelper)
/**
 @brief remove first letter of the string, then compare. 
 i.e. "C3:45:EF:EC:A4:26" is equal to "43:45:EF:EC:A4:26"
 @return BOOL YES means equal, otherwise not equal.
 
 */
- (BOOL)compareMacAddrSuffixIsEqual:(NSString *)macAddr;
@end